package com.dfbz.demo01_继承的语法;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo01 {

    public static void main(String[] args) {

        Student student = new Student();
        student.name = "小灰";
        student.age = 20;
        student.eat();
        System.out.println("---------------");

        Teacher teacher=new Teacher();
        teacher.name="小红";
        teacher.age=30;
        teacher.eat();
        System.out.println("---------------");

        Worker worker=new Worker();
        worker.name="小刚";
        worker.age=40;
        worker.eat();


    }
}

class Person {
    String name;
    int age;

    public void eat() {
        System.out.println("年龄为【" + age + "】岁的【" + name + "】正在吃饭");
    }
}

class Student extends Person {
}

class Teacher extends Person {
}

class Worker extends Person {
}